<?php
namespace iBrand\Component\Refund;

use iBrand\Component\Refund\Models\Refund;
use iBrand\Component\Refund\Observers\RefundObserver;
use iBrand\Component\Refund\Repositories\Eloquent\RefundRepositoryEloquent;
use iBrand\Component\Refund\Repositories\RefundRepository;
use Illuminate\Support\ServiceProvider;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/11/6
 * Time: 15:58
 */
class RefundServiceProvider extends ServiceProvider
{

    public function boot()
    {
        if ($this->app->runningInConsole()) {
            $this->registerMigrations();
        }

        Refund::observe(RefundObserver::class);
    }

    protected function registerMigrations()
    {
        return $this->loadMigrationsFrom(__DIR__ . '/../migrations');
    }

    public function register()
    {
        $this->app->bind(RefundRepository::class, RefundRepositoryEloquent::class);
    }
}